package com.chao.ClientSocket;

import sun.reflect.generics.scope.Scope;

import java.io.IOException;
import java.net.Socket;

public class PortScan {
    public static void main(String[] args) {
        for (int i = 0; i < 1024; i++) {
            System.out.println(i +"/" +1024);
            try{
                Socket s=new Socket("localhost",i);
                System.out.println("端口使用中：" +i);
                s.close();
            }catch (IOException ex){

            }
        }
    }
}
